package com.wcarmon.life.command{

    import com.adobe.cairngorm.commands.ICommand
    import com.adobe.cairngorm.control.CairngormEvent;
	import mx.controls.Alert;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.IResponder;
	import com.wcarmon.life.model.LifeModelLocator;
	import com.wcarmon.life.event.*;
	import com.wcarmon.life.business.*;
	import com.wcarmon.life.vo.*;
	import mx.utils.ObjectUtil;
	import mx.collections.*;
	
	
	
	public class ShowOrganizeListCommand implements ICommand, IResponder {
		include "../../includes/loggerSnippet.as";
			
		public var listType : String;
		
		public function execute( event : CairngormEvent ) : void { 
			var e : ShowOrganizeListEvent = ShowOrganizeListEvent( event );
			this.listType = e.listType;
			( new GetBlockListDelegate(this) ).getList( e.listType );	
		}

	 	public function result( event : Object ) : void {
			var e : ResultEvent = ResultEvent(event);
			var model : LifeModelLocator = LifeModelLocator.getInstance();
			
			model.currentOrganizeList = e.result as Array;
			model.currentOrganizeListType = this.listType;
			model.gotoScreen( LifeModelLocator.SCREEN_ORGANIZE_LIST );
		}
	
		public function fault( event : Object ) : void {
			include "includes/FaultSnippet.as";
		}
	}
}